class Utils {
  static randomRange(min: number, max: number) {
    return min + Math.random() * (max - min);
  }

  static randomRangeInt(min: number, max: number) {
    return Math.floor(this.randomRange(min, max));
  }

  static pointDistance(p1: { x: number; y: number }, p2: { x: number; y: number }) {
    return Math.sqrt(Math.abs(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2)));
  }

  static delay(time: number) {
    return new Promise((r) => setTimeout(r, time));
  }
}
